package router

import (
	"gin-init/internal/api"
	"gin-init/internal/middleware"

	"github.com/gin-gonic/gin"
	"github.com/google/wire"
)

var RouterSet = wire.NewSet(wire.Struct(new(Router), "*"), wire.Bind(new(IRouter), new(*Router)))

type IRouter interface {
	Register(engine *gin.Engine) error
}

type Router struct {
	*api.DemoApi
}

func (r *Router) Register(engine *gin.Engine) error {
	engine.Use(middleware.Recovery())

	v1Group := engine.Group("/v1")
	{
		v1Group.GET("/demo", r.DemoApi.GetDefault)
	}

	return nil
}
